Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download compression is too slow #727

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

fengelniederhammer
Copy link
Contributor

@fengelniederhammer fengelniederhammer commented Apr 3, 2024

resolves #717

Tests on a medium-sized data set (3552 sequences):
I measured request times of /sample/unalignedNucleotideSequences:

  • uncompressed: 1300 ms, 65 MB
  • gzip compressed: 3100 ms (before: 14 s), 8 MB
  • zstd compressed: 970 ms (before: 7.4 s), 342 kB

I tested this using the Ebola dataset from Loculus. I pushed it to a branch: https://github.com/GenSpectrum/LAPIS/tree/ebolaTestData

PR Checklist

  • [ ] All necessary documentation has been adapted.
  • [ ] The implemented feature is covered by an appropriate test.

and reduce logging noise from data version checker
Tests on a medium-sized data set (3552 sequences):
I measured request times of /sample/unalignedNucleotideSequences:
- uncompressed: 1300 ms, 65 MB
- gzip compressed: 3100 ms (before: 14 s), 8 MB
- zstd compressed: 970 ms (before: 7.4 s), 342 kB
Copy link
Member

@chaoran-chen chaoran-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! What was the issue before? (I don't really understand what the changed code is doing.)

Comment on lines +225 to +235
override fun write(bytes: ByteArray) {
compressingStream.write(bytes)
}

override fun write(
bytes: ByteArray,
offset: Int,
length: Int,
) {
compressingStream.write(bytes, offset, length)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chaoran-chen Those are the relevant changes. We didn't forward those methods to the compressing stream. Instead, the default implementation would call fun write(byte: Int) for every entry of the ByteArray. Apparently the compression streams can do a lot better than writing every byte individually.

Copy link
Contributor

@JonasKellerer JonasKellerer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (works on my machine :) )

@fengelniederhammer fengelniederhammer merged commit 1624580 into main Apr 3, 2024
10 checks passed
@fengelniederhammer fengelniederhammer deleted the 717-download-compression-is-too-slow branch April 3, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Download compression is too slow
3 participants